package pages;

import java.util.List;

import org.openqa.selenium.WebElement;

import io.appium.java_client.AppiumBy;
import io.appium.java_client.android.AndroidDriver;
import utiles.BaseAction;

public class SportPage {
	AndroidDriver  driver;
	BaseAction action;

	public SportPage(AndroidDriver  driver) {
		this.driver = driver;
		action= new BaseAction(driver);
	}	
	
	public WebElement get_listItem(int i) {
		WebElement list_view=driver.findElement(AppiumBy
				.id("njust.dzh.fitnesssystem:id/recycler_view"));
		List<WebElement> items= list_view.findElements(AppiumBy
				.className("android.widget.FrameLayout"));
		return items.get(i);
	}
	
	public ExercisePage click_sportItem(int i) throws InterruptedException {	
		
		action.click(this.get_listItem(i));
		return new ExercisePage(driver);
		
	}

}
